<extend name="Public/base"/>

<block name="body">

    <div class="main-title">
        <h2>更新商品信息</h2>
    </div>
    <div id="show-list" class="install-database">
    </div>

</block>
<block name="script">
    <script type="text/javascript">
        var list                        = document.getElementById('show-list');
        var goodsList                   =   {$goods_list};
        var j                           =   0;
        console.log(goodsList.length);
        for (var i=0;i<goodsList.length;i++){
            $.post("{:U('Collect/updateOne')}",goodsList[i]).success(function (data) {
                var list   = document.getElementById('show-list');
                    var li = document.createElement('p');
                    li.innerHTML = data.info;
                    list.appendChild(li);
                    document.scrollTop += 30;
                    j++;
                    if(j==goodsList.length){
                        var li = document.createElement('p');
                        li.innerHTML = '更新完成';
                        list.appendChild(li);
                        document.scrollTop += 30;
                    }

                    console.log(j);
            });
        }

    </script>
</block>

